package com.ah.controller;

import com.ah.service.IGoodsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class GoodsController {

    @Autowired
    private IGoodsService goodsService;

    @RequestMapping("/goods/list")
    public String list(){
        goodsService.queryGoods();
        return "goodslist";
    }

    @RequestMapping("/goods/add")
    public String add(){
        System.out.println(goodsService.add());
        return "goodsadd";
    }

    @RequestMapping("/goods/findbyid")
    public String goodsById(@RequestParam("id") Integer id){
        goodsService.findById(id);
        return "goodsfindbyid";
    }
}
